package com.example.lishop.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.validation.annotation.Validated;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Objects;

/**
 * Created on 2021/4/5 16:25
 *
 * @author shuguo
 */
@Entity
@Table(name = "b_company", schema = "db_li_shop", catalog = "")
@IdClass(BCompanyEntityPK.class)
@DynamicInsert
@DynamicUpdate
@ApiModel(value = "BCompanyEntity", description = "公司、企业信息")
public class BCompanyEntity {
    @ApiModelProperty(value = "表的id,自增")
    private int id;
    @NotBlank(message = "companyId不能为空")
    @ApiModelProperty(value = "PRIMARY KEY , 唯一")
    private String companyId;
    @ApiModelProperty(value = "商家名称")
    private String name;
    @ApiModelProperty(value = "描述，详细介绍")
    private String descript;
    @ApiModelProperty(value = "类型")
    private String type;
    @ApiModelProperty(value = "标签")
    private String tag;
    @ApiModelProperty(value = "状态：0=正常，1=冻结")
    private String status;
    @ApiModelProperty(value = "删除状态：0=正常，1=删除")
    private String sts;
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @Id
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Id
    @Column(name = "company_id")
    public String getCompanyId() {
        return companyId;
    }

    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "descript")
    public String getDescript() {
        return descript;
    }

    public void setDescript(String descript) {
        this.descript = descript;
    }

    @Basic
    @Column(name = "type")
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Basic
    @Column(name = "tag")
    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    @Basic
    @Column(name = "status")
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Basic
    @Column(name = "sts")
    public String getSts() {
        return sts;
    }

    public void setSts(String sts) {
        this.sts = sts;
    }

    @Basic
    @Column(name = "update_time")
    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Basic
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BCompanyEntity that = (BCompanyEntity) o;
        return id == that.id &&
                Objects.equals(companyId, that.companyId) &&
                Objects.equals(name, that.name) &&
                Objects.equals(descript, that.descript) &&
                Objects.equals(type, that.type) &&
                Objects.equals(tag, that.tag) &&
                Objects.equals(status, that.status) &&
                Objects.equals(sts, that.sts) &&
                Objects.equals(updateTime, that.updateTime) &&
                Objects.equals(createTime, that.createTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, companyId, name, descript, type, tag, status, sts, updateTime, createTime);
    }
}
